function offset = apcOffset(prn, epoch,const)

switch const
    case 'GPS'
        
        offsetTable = [...
            %    PRN         SVN START EPOCH   END EPOCH         DX           DY        DZ
            1          32   406425600   908236800       0.279           0      2.3195
            1          37   908755200   915321600       0.279           0      2.2893
            1          49   921888000   988761600           0           0      0.9632
            1          35   991008000   994550400       0.279           0      2.5742
            1          63   994809600         Inf       0.394           0      1.5018
            2          13   297475200   768441600       0.279           0      2.6584
            2          61   783734400         Inf      0.0013     -0.0011      0.7288
            3          11   181699200   450662400        0.21           0      1.8845
            3          33   512006400  1092441600       0.279           0      2.7573
            3          35  1093910400  1097884800       0.279           0      2.5742
            3          69  1098576000         Inf       0.394           0      1.5506
            4           1           0   174528000           0           0         1.9
            4          34   435628800  1131148800       0.279           0      2.3524
            4          49  1138406400  1157846400           0           0      0.9632
            4          32  1157932800  1165017600       0.279           0      2.3195
            4          34  1165276800  1167523200       0.279           0      2.3524
            4          49  1167696000         Inf           0           0      0.9632
            5           5     2937600   137203200           0           0         1.9
            5          35   430704000   928540800       0.279           0      2.5742
            5          50   934502400         Inf     -0.0033     -0.0003       0.778
            6           3           0   390268800           0           0         1.9
            6          36   447292800  1077926400       0.279           0      2.8341
            6          49  1080518400  1083369600           0           0      0.9632
            6          67  1084320000         Inf       0.394           0       1.467
            7           2           0   255744000           0           0         1.9
            7          37   421286400   884390400       0.279           0      2.2893
            7          48   889574400         Inf     -0.0004       0.005      0.8224
            8           4           0   308448000           0           0         1.9
            8          38   562809600  1113004800       0.279           0      2.5171
            8          49  1114387200  1119830400           0           0      0.9632
            8          72  1120953600         Inf       0.394           0      1.5014
            9           6     9590400   352339200        0.21           0         1.9
            9          39   425088000  1090022400       0.279           0       2.391
            9          68  1090972800         Inf       0.394           0      1.5226
            10          40   521510400  1122681600       0.279           0      2.4717
            10          36  1126396800  1129939200       0.279           0      2.8341
            10          73  1130284800         Inf       0.394           0      1.5151
            11           8   111024000   420595200        0.21           0         1.9
            11          46   623289600         Inf     -0.0007     -0.0012      1.1178
            12          10   147484800   512006400        0.21           0      1.7775
            12          58   847756800         Inf      0.0102     -0.0056      0.7678
            13           9   139968000   456192000        0.21           0      2.0307
            13          43   553651200         Inf     -0.0024     -0.0016      1.3483
            14          14   287452800   640051200       0.279           0      2.7857
            14          41   657849600         Inf     -0.0025     -0.0017      1.3045
            15          15   338774400   857952000       0.279           0      2.4066
            15          55   876614400         Inf      0.0045      0.0019      0.6228
            16          16   303436800   655516800       0.279           0      2.4512
            16          56   727833600         Inf      0.0126     -0.0069      1.4687
            17          17   313372800   793238400       0.279           0      2.3506
            17          53   811728000         Inf       0.003       0.001      0.7709
            18          18   317174400   650678400       0.279           0      2.5166
            18          54   664848000         Inf      0.0139      0.0003      1.2486
            19          19   308966400   684460800       0.279           0      2.9116
            19          59   763776000         Inf      0.0086     -0.0006      0.8082
            20          20   322444800   534556800       0.279           0       2.483
            20          51   642038400         Inf       0.001     -0.0032      1.3135
            21          21   333590400   727747200       0.279           0      2.4557
            21          45   733104000         Inf     -0.0034      0.0029      1.3591
            22          22   412732800   744249600       0.279           0      2.3906
            22          47   756000000         Inf     -0.0022      0.0022      0.8506
            23          23   343612800   761529600       0.279           0      2.7208
            23          60   771984000         Inf      0.0154      0.0068      0.7661
            24          24   362620800  1001462400       0.279           0       2.546
            24          49  1012176000  1015804800           0           0      0.9632
            24          32  1015804800  1019433600       0.279           0      2.3195
            24          37  1019433600  1022457600       0.279           0      2.2893
            24          49  1028505600  1029715200           0           0      0.9632
            24          65  1033344000         Inf       0.394           0      1.4071
            25          25   382838400   949708800       0.279           0      2.4307
            25          35   949708800   959040000       0.279           0      2.5742
            25          62   959040000         Inf       0.394           0      1.5174
            26          26   394502400  1104537600       0.279           0       2.381
            26          32  1107129600  1108857600       0.279           0      2.3195
            26          27  1109030400  1110585600       0.279           0      2.5655
            26          71  1111276800         Inf       0.394           0      1.5035
            27          27   400032000  1034553600       0.279           0      2.5655
            27          49  1034553600  1052179200           0           0      0.9632
            27          66  1052611200         Inf       0.394           0      1.5223
            28          28   386899200   555724800       0.279           0      2.2552
            28          44   647740800         Inf      0.0014      0.0047      0.9995
            29          29   408672000   877219200       0.279           0        2.46
            29          57   882144000         Inf      0.0109     -0.0045      0.7918
            30          30   526521600   996537600       0.279           0      2.5641
            30          35   996537600  1051920000       0.279           0      2.5742
            30          49  1052179200  1061164800           0           0      0.9632
            30          32  1061164800  1063411200       0.279           0      2.3195
            30          37  1063584000  1065225600       0.279           0      2.2893
            30          27  1070064000  1071360000       0.279           0      2.5655
            30          49  1071446400  1076112000           0           0      0.9632
            30          64  1076976000         Inf       0.394           0      1.5221
            31          31   417484800   814233600       0.279           0      2.1976
            31          52   843177600         Inf     -0.0008      0.0058      0.9125
            32          23   849052800  1137801600       0.279           0      2.7208
            32          70  1138665600         Inf       0.394           0      1.5348];
    case 'GLO'
        
        offsetTable = [...
            1          679    599011200    788054400            0            0          2.1;...
            1          696    788054400    944784000            0            0       2.1009;...
            1          730    944784000          Inf       -0.545            0       2.5003;...
            2          694    755049600    914198400            0            0       2.0492;...
            2          728    914198400   1056672000       -0.545            0       2.4663;...
            2          747   1056672000          Inf       -0.545            0         2.45;...
            3          663    469324800    691200000            0            0          2.1;...
            3          689    691200000    914198400            0            0       2.1036;...
            3          727    914198400    969926400       -0.545            0       2.3805;...
            3          722    969926400    976492800       -0.545            0       2.5485;...
            3          727    976492800    983836800       -0.545            0       2.3805;...
            3          715    983836800   1002499200       -0.545            0       2.5056;...
            3          801   1002499200   1006732800            0            0       2.0668;...
            3          744   1006732800          Inf       -0.545            0       2.5631;...
            4          662    469324800    755049600            0            0          2.1;...
            4          695    755049600    944784000            0            0       2.1148;...
            4          733    944784000    969926400       -0.545            0       2.4598;...
            4          727    969926400    982713600       -0.545            0       2.3805;...
            4          801    982713600   1002499200            0            0       2.0668;...
            4          742   1002499200          Inf       -0.545            0       2.3811;...
            5          611    691200000    944784000            0            0       2.1133;...
            5          734    944784000          Inf       -0.545            0       2.4893;...
            6          664    469324800    691200000            0            0          2.1;...
            6          690    691200000    755049600            0            0          2.1;...
            6          701    755049600    956448000       -0.545            0       2.3303;...
            6          714    956448000    969926400       -0.545            0       2.1794;...
            6          733    969926400          Inf       -0.545            0       2.4598;...
            7          686    599011200    788054400            0            0          2.1;...
            7          712    788054400   1007942400       -0.545            0       2.4275;...
            7          745   1007942400          Inf       -0.545            0       2.6372;...
            8          684    599011200    788054400            0            0       2.0764;...
            8          697    788054400    914198400            0            0        1.962;...
            8          729    914198400   1031529600       -0.545            0        2.558;...
            8          743   1031529600   1034553600       -0.545            0         2.45;...
            8          712   1034553600   1040169600       -0.545            0       2.4275;...
            8          743   1040169600   1041465600       -0.545            0         2.45;...
            8          801   1041465600   1045612800            0            0       2.0668;...
            8          743   1045612800          Inf       -0.545            0         2.45;...
            9          676    502934400    882576000            0            0          2.1;...
            9          722    882576000    969926400       -0.545            0       2.5485;...
            9          736    969926400   1139616000       -0.545            0       2.4017;...
            9          802   1139616000          Inf            0            0         2.05;...
            10          681    490579200    851040000            0            0          2.1;...
            10          717    851040000          Inf       -0.545            0        2.369;...
            11          685    490579200    882576000            0            0          2.1;...
            11          723    882576000   1150761600       -0.545            0       2.4254;...
            11          853   1150761600          Inf       -0.545            0         2.45;...
            12          667    460598400    967420800            0            0          2.1;...
            12          737    967420800          Inf       -0.545            0       2.5084;...
            13          682    502934400    882576000            0            0          2.1;...
            13          721    882576000          Inf       -0.545            0       2.4179;...
            14          670    460598400    851040000            0            0          2.1;...
            14          715    851040000    976492800       -0.545            0       2.5056;...
            14          722    976492800   1002499200       -0.545            0       2.5485;...
            14          715   1002499200          Inf       -0.545            0       2.5056;...
            15          680    490579200    607478400            0            0          2.1;...
            15          678    607478400    851040000            0            0          2.1;...
            15          716    851040000          Inf       -0.545            0       2.5051;...
            16          675    460598400    967420800            0            0          2.1;...
            16          736    967420800    969926400       -0.545            0       2.4017;...
            16          738    969926400   1141516800       -0.545            0       2.5161;...
            16          736   1141516800          Inf       -0.545            0       2.4017;...
            17          660    450057600    655430400            0            0          2.1;...
            17          687    655430400    877392000            0            0       2.2082;...
            17          718    877392000    976492800       -0.545            0       2.5349;...
            17          714    976492800   1008374400       -0.545            0       2.1794;...
            17          746   1008374400   1112918400       -0.545            0       2.7436;...
            17          714   1112918400   1137888000       -0.545            0       2.1794;...
            17          802   1137888000   1139616000            0            0         2.05;...
            17          714   1139616000   1140307200       -0.545            0       2.1794;...
            17          851   1140307200          Inf       -0.545            0         2.45;...
            18          658    450057600    655430400            0            0          2.1;...
            18          683    655430400    906336000            0            0       2.0694;...
            18          724    906336000   1076716800       -0.545            0       2.4484;...
            18          714   1076716800   1081209600       -0.545            0       2.1794;...
            18          754   1081209600          Inf       -0.545            0         2.45;...
            19          677    478569600    819504000            0            0          2.1;...
            19          698    819504000    877392000            0            0       2.1031;...
            19          720    877392000          Inf       -0.545            0       2.4984;...
            20          665    478569600    825120000            0            0          2.1;...
            20          693    825120000    877392000            0            0       2.1227;...
            20          719    877392000          Inf       -0.545            0       2.4482;...
            21          692    724809600    906336000            0            0       2.0979;...
            21          725    906336000   1090972800       -0.545            0       2.3298;...
            21          755   1090972800          Inf       -0.545            0         2.45;...
            22          666    478569600    724809600            0            0          2.1;...
            22          691    724809600    877392000            0            0       2.0993;...
            22          698    877392000    906336000            0            0       2.1031;...
            22          726    906336000    951436800       -0.545            0       2.4017;...
            22          731    951436800          Inf       -0.545            0        2.411;...
            23          661    450057600    724809600            0            0          2.1;...
            23          693    724809600    825120000            0            0       2.1227;...
            23          714    825120000    952992000       -0.545            0       2.1794;...
            23          732    952992000          Inf       -0.545            0       2.3182;...
            24          688    655430400    819504000            0            0       2.2223;...
            24          713    819504000    951436800       -0.545            0       2.4954;...
            24          735    951436800          Inf       -0.545            0        2.483;...
            26          801   1015804800   1041465600            0            0       2.0668;...
            26          801   1045612800          Inf            0            0       2.0668;...
            27          802   1101340800   1137888000            0            0         2.05];
        
        
end

idx = find(offsetTable(:,1) == prn &  epoch >= offsetTable(:,3) &  epoch < offsetTable(:,4));

offset = offsetTable(idx,5:7)';

if isempty(offset)
   offset = nan(3,1); 
end

end